import React from 'react';
import { useRoutes } from 'react-router-dom';
import zhCN from 'antd/lib/locale/zh_CN';
import { ConfigProvider } from 'antd';
import { App as AntdApp } from 'antd';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import routes, { transformRoutes } from './routes';

dayjs.locale('zh-cn');

const App = () => {
  const pages = useRoutes(transformRoutes(routes));

  return (
    <ConfigProvider
      locale={zhCN}
      theme={{
        token: {
          colorPrimary: '#00b96b',
          borderRadius: 4,
        },
      }}
    >
      <AntdApp message={{ maxCount: 1 }} style={{ width: '100%', height: '100%' }}>
        {pages}
      </AntdApp>
    </ConfigProvider>
  );
};

export default App;
